#ifndef FFSTARTEVENT_H
#define FFSTARTEVENT_H

#include "ffevent.h"

// 前置声明相关类，避免头文件循环包含问题
class FFDemuxerThread;
class FFVDecoderThread;
class FFADecoderThread;
class FFARender;
class FFVRender;
class FFDemuxer;
class FFADecoder;
class FFVDecoder;
class FFAPacketQueue;
class FFVPacketQueue;
class FFAFrameQueue;
class FFVFrameQueue;
class FFPlayerWindow;

class FFStartEvent : public FFEvent
{
public:
    FFStartEvent(FFPlayerContext* playerCtx, const std::string& url);

    virtual void work() override;

private:
    void stopAll();
    void initAll();
    void startAll();

    FFDemuxerThread* demuxerThread;
    FFVDecoderThread* vDecoderThread;
    FFADecoderThread* aDecoderThread;
    FFARender* aRender;
    FFVRender* vRender;
    FFDemuxer* demuxer;
    FFADecoder* aDecoder;
    FFVDecoder* vDecoder;
    FFAPacketQueue* aPktQueue;
    FFVPacketQueue* vPktQueue;
    FFAFrameQueue* aFrmQueue;
    FFVFrameQueue* vFrmQueue;
    FFPlayerWindow* playerWindow;

    std::string url;
};

#endif // FFSTARTEVENT_H
